package m.store.model;

import m.base.model.UserInfo;
import m.common.model.*;
import m.common.model.type.FieldType;
import m.common.model.util.ModelQueryList;
import m.common.model.util.QueryCondition;

import java.util.Date;
import java.util.List;
import java.util.stream.Collectors;

@TableMeta(name="ts_order_repository_check",description="订单仓库审核")
public class OrderRepositoryCheck extends Model implements MigrationModel {
    @Override
    public List<String> migrationOidList(String storeOid) throws Exception {
        return ModelQueryList.getModelList(this.getClass(),new String[]{"oid"},null,
                        QueryCondition.eq("repository.store.oid",storeOid))
                .stream().map(Model::getOid).collect(Collectors.toList());
    }
    @LinkTableMeta(name="repository_oid",table= RepositoryInfo.class,description="仓库")
    private RepositoryInfo repository;
    @LinkTableMeta(name="check_user_oid",table= UserInfo.class,description="审核用户")
    private UserInfo checkUser;
    @LinkTableMeta(name="stock_record_oid",table= GoodsStockRecord.class,description="库存记录")
    private GoodsStockRecord stockRecord;
    @LinkTableMeta(name="goods_oid",table= StoreGoods.class,description="商品")
    private StoreGoods goods;
    @FieldMeta(name="price",type= FieldType.DOUBLE,description="单价")
    private Double price;
    @FieldMeta(name="num",type= FieldType.INT,description="数量")
    private Integer num;
    @FieldMeta(name="preferential",type= FieldType.DOUBLE,description="总优惠")
    private Double preferential;
    @FieldMeta(name="amount",type= FieldType.DOUBLE,description="金额")
    private Double amount;
    @FieldMeta(name="preferential_price",type= FieldType.DOUBLE,description="优惠后单价")
    private Double preferentialPrice;
    @FieldMeta(name = "remark",type = FieldType.STRING,length = 1000,description = "备注")
    private String remark;
    @FieldMeta(name="order_type",type= FieldType.STRING,length = 20,description="订单类型",dictOption = "A:正常出库,B:正常入库,C:入库退货,D:出库退货,E:盘点出库,F:盘点入库,G:生产出库,H:生产入库")
    private String orderType;
    public final static String OrderType_Sale="A";
    public final static String OrderType_Stock="B";
    public final static String OrderType_StockRefund="C";
    public final static String OrderType_SaleRefund="D";
    public final static String OrderType_CountSale="E";
    public final static String OrderType_CountStock="F";
    public final static String OrderType_ProduceSale="G";
    public final static String OrderType_ProduceStock="H";
    @FieldMeta(name="order_no",type= FieldType.STRING,length = 20,description="订单单号")
    private String orderNo;
    @FieldMeta(name="order_oid",type= FieldType.STRING,length = 50,description="订单主键")
    private String orderOid;
    @FieldMeta(name="order_date",type= FieldType.DATE,description="订单账期")
    private Date orderDate;
    @FieldMeta(name="status",type= FieldType.STRING,description="状态",dictOption = "A:未审核,B:无需审核,Y:通过,N:不通过")
    private String status;
    public final static String Status_Check="A";
    public final static String Status_View="B";
    public final static String Status_Yes="Y";
    public final static String Status_No="N";
    @FieldMeta(name = "check_remark",type = FieldType.STRING,length = 1000,description = "审核备注")
    private String checkRemark;
    @FieldMeta(name="check_date",type= FieldType.DATE,description="审核时间")
    private Date checkDate;

    public RepositoryInfo getRepository() {
        return repository;
    }

    public void setRepository(RepositoryInfo repository) {
        this.repository = repository;
    }

    public StoreGoods getGoods() {
        return goods;
    }

    public void setGoods(StoreGoods goods) {
        this.goods = goods;
    }

    public Double getPreferential() {
        return preferential;
    }

    public void setPreferential(Double preferential) {
        this.preferential = preferential;
    }

    public Double getPreferentialPrice() {
        return preferentialPrice;
    }

    public void setPreferentialPrice(Double preferentialPrice) {
        this.preferentialPrice = preferentialPrice;
    }

    public String getCheckRemark() {
        return checkRemark;
    }

    public void setCheckRemark(String checkRemark) {
        this.checkRemark = checkRemark;
    }

    public UserInfo getCheckUser() {
        return checkUser;
    }

    public void setCheckUser(UserInfo checkUser) {
        this.checkUser = checkUser;
    }

    public GoodsStockRecord getStockRecord() {
        return stockRecord;
    }

    public void setStockRecord(GoodsStockRecord stockRecord) {
        this.stockRecord = stockRecord;
    }

    public Double getPrice() {
        return price;
    }

    public void setPrice(Double price) {
        this.price = price;
    }

    public Integer getNum() {
        return num;
    }

    public void setNum(Integer num) {
        this.num = num;
    }

    public Double getAmount() {
        return amount;
    }

    public void setAmount(Double amount) {
        this.amount = amount;
    }

    public String getOrderType() {
        return orderType;
    }

    public void setOrderType(String orderType) {
        this.orderType = orderType;
    }

    public String getOrderNo() {
        return orderNo;
    }

    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }

    public String getOrderOid() {
        return orderOid;
    }

    public void setOrderOid(String orderOid) {
        this.orderOid = orderOid;
    }

    public Date getOrderDate() {
        return orderDate;
    }

    public void setOrderDate(Date orderDate) {
        this.orderDate = orderDate;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public Date getCheckDate() {
        return checkDate;
    }

    public void setCheckDate(Date checkDate) {
        this.checkDate = checkDate;
    }
}
